<template xmlns:v-on="http://www.w3.org/1999/xhtml">
  <div class="content">
    <div class="content-center">
      <!-- 头部 -->
      <div class="main-title">
        <h2>模板编辑</h2>
      </div>
      <div class="main-list">
        <div class="main-list-title">
          <div>
            <div @click="mainlistselectClick(0)" :class="{'main-list-basic':ismainlistbasic,'main-list-select':ismainlistselect == 0}">
              面试邀请模板
            </div>
            <div @click="mainlistselectClick(1)" :class="{'main-list-feedback':ismainlistfeedback,'main-list-select':ismainlistselect == 1}">
              offer模板
            </div>
          </div>
          <div>
            <div class="title-right-but" @click="addClick">
              <div class="title-r-but-left">
                <img src="static/img/添加.png" alt="">
              </div>
              <div class="title-r-but-right">
                新增模板
              </div>
            </div>
          </div>
        </div>
        <!-- 面试邀请模板 -->
        <div class="main-content">
          <div class="main-content-list">
            <ul>
              <li class="fistLi">
                <div class="liOne">编号</div>
                <div class="liOne">名称</div>
                <!-- <div class="liOne">形式</div> -->
                <!-- <div class="liOne">上传时间</div> -->
                <!-- <div class="liOne">编辑人</div> -->
                <!-- <div class="liOne">状态</div> -->
                <div class="liOne">操作</div>
              </li>
              <li class="dataLi" v-for="(item,index) in lists" :key="index">
                <div>1</div>
                <div>{{modelName}}</div>
                <!-- <div>2017.11.11</div>
                <div>3123123</div>
                <div>3213123</div>
                <div>2017.11.11</div> -->
                <div class="data-operation">
                  <div @click="lookClick(index)">
                    <img src="static/img/预览.png" alt="" title="预览">
                  </div>
                  <!-- <div @click="updateClick(index)">
                    <img src="static/img/更改标签.png" alt="" title="编辑">
                  </div> -->
                  <!-- <div @click="deleteClick(index)">
                    <img src="static/img/删除.png" alt="" title="删除">
                  </div> -->
                </div>
              </li>
              <li class="pageLi">
                <div></div>
                <div>
                  <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40]"
                    :page-size="pageSizeNum" layout="total,sizes,prev, pager, next,jumper" :total="totalNum">
                  </el-pagination>
                </div>
              </li>
            </ul>
          </div>
        </div>
        <!-- offer模板 -->
        <!-- <div v-show="mainContentShow == 1" class="main-content">
          <div class="main-content-list">
            <ul>
              <li class="fistLi">
                <div class="liOne">编号</div>
                <div class="liOne">姓名</div>
                <div class="liOne">形式</div>
                <div class="liOne">上传时间</div>
                <div class="liOne">编辑人</div>
                <div class="liOne">状态</div>
                <div class="liOne">操作</div>
              </li>
              <li class="dataLi" v-for="(item,index) in lists" :key="index">
                <div>fas</div>
                <div>发生的</div>
                <div>烦死哒.11.11</div>
                <div>法多</div>
                <div>发生的</div>
                <div>2017.11.11</div>
                <div class="data-operation">
                  <div>
                    <img src="static/img/预览.png" alt="" title="预览">
                  </div>
                  <div>
                    <img src="static/img/更改标签.png" alt="" title="编辑">
                  </div>
                  <div>
                    <img src="static/img/删除.png" alt="" title="删除">
                  </div>
                </div>
              </li>
              <li class="pageLi">
                <div></div>
                <div>
                  <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 30, 40]"
                    :page-size="pageSizeNum" layout="total,sizes,prev, pager, next,jumper" :total="totalNum">
                  </el-pagination>
                </div>
              </li>
            </ul>
          </div>
        </div> -->
      </div>
      <div :class="{showdel:isShowdel}" class="delPopup">
        <transition name="slide-fade">
            <v-mDel @ok="confirmClick" @canle="cancelClick" :name="titlename"></v-mDel>
        </transition>
      </div>
      <div v-show="isShowLook" class="lookShow">
        <div class="main-lookShow">
          <div class="main-lookShow-top">
            <div>个人简历</div>
            <div @click="lookHideClick">X</div>
          </div>
          <div class="main-lookShow-bottom">

          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapActions } from "vuex";
import mDel from "../module/mDel";
export default {
  components: {
    "v-mDel": mDel
  },
  data() {
    return {
      modelName: "面试邀请模板",
      isShowLook: false,
      lists: [
        {
          id: 1,
          creator: 0,
          createDate: 0,
          lastModifier: 0,
          lastModDate: 0,
          deleteFlag: 1,
          name: "成意",
          phone: null,
          email: null,
          source: 1,
          position: null,
          workYear: null,
          sex: "男",
          hr: null,
          contactTime: null,
          status: null
        }
      ],
      mainContentShow: 0,
      ismainlistfeedback: true,
      ismainlistbasic: true,
      ismainlistselect: 0,
      isShowdel: true,
      toPath: "",
      titlename: "劳动成果还未保存，是否退出？",
      pageSizeNum: 10,
      currentPage: 1,
      totalNum: 1
    };
  },
  // 过滤
  filters: {
    timeFun: function(val) {
      var now = new Date(val);
      var year = now.getYear() - 100;
      var month = now.getMonth() + 1;
      month = month > 9 ? month : "0 " + month;
      var date = now.getDate();
      date = date > 9 ? date : "0 " + date;
      var hour = now.getHours();
      hour = hour > 9 ? hour : "0 " + hour;
      var minute = now.getMinutes();
      minute = minute > 9 ? minute : "0 " + minute;
      return (
        "20 " + year + "- " + month + "- " + date + " " + hour + ": " + minute
      );
    }
  },
  // 模块新建时
  created: function() {
    var self = this;
    self.listFun();
  },
  // 计算属性
  mounted() {},
  // 事件处理
  methods: {
    // 新增模板
    addClick() {
      // this.$router.push({
      //   path: "/home/opTemplate"
      // });
      this.$message({
        type: "info",
        message: "暂不支持添加"
      });
    },
    // 头部切换
    mainlistselectClick(index) {
      this.mainContentShow = index;
      this.ismainlistselect = index;
      if (index == 0) {
        this.modelName = "面试邀请模板";
      } else {
        this.modelName = "offer模板";
      }
    },
    // 编辑
    updateClick() {},
    deleteClick() {
      this.isShowdel = false;
      this.titlename = "是否要删除该模板？";
    },
    confirmClick() {
      this.isShowdel = true;
    },
    //取消未保存弹出框
    cancelClick() {
      this.isShowdel = true;
    },
    // 预览
    lookHideClick() {
      this.isShowLook = false;
     
    },
    lookClick(index) {
      // this.isShowLook = true;
       window.open('http://192.168.10.117:8080/api/file/docxPreviewer/offer.docx');
    },
    // 点击分页
    handleCurrentChange(val) {
      var self = this;
      self.currentPage = val;
      self.listFun();
    },
    // 选择每页个数
    handleSizeChange(val) {
      var self = this;
      self.pageSizeNum = val;
      self.listFun();
    },
    // 获取列表
    listFun() {
      var self = this;
      var self = this;
      self
        .getuserpage({
          pageIndex: self.currentPage,
          pageSize: self.pageSizeNum
        })
        .then(data => {
          if (data.code == 200) {
            // self.lists = data.data.records;
            // self.totalNum = data.data.total;
          } else {
            self.$message({
              type: "info",
              message: data.message
            });
          }
        })
        .catch(msg => {
          self.$message({
            type: "info",
            message: "服务器异常!"
          });
        });
    },

    ...mapActions(["getuserpage"])
  },
  // 监视
  watch: {}
};
</script>
<style scoped>
.title-right {
  height: 50px;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.title-r-but-right {
  min-width: 15px;
  font-size: 13px;
  color: #fff;
}

.title-r-but-left {
  width: 15px;
  height: 27px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.title-r-but-left img {
  width: 100%;
  height: 100%;
  width: 15px;
  height: 15px;
}

.title-right-but {
  width: 90px;
  height: 30px;
  line-height: 30px;
  background-color: #2fa89e;
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-radius: 3px;
  cursor: pointer;
}

.fistLi,
.dataLi,
.pageLi {
  width: 100%;
  min-height: 50px;
}

.pageLi {
  margin-top: 15px;
  margin-bottom: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pageLi > div:nth-child(1) {
  width: 100px;
}

.pageLi > div:nth-child(2) {
  min-width: 300px;
  margin-right: 5px;
}

.fistLi {
  border-bottom: 3px solid #eeeded;
  display: flex;
}

.dataLi {
  border-bottom: 1px solid #ccc;
  display: flex;
}

.fistLi > div {
  color: #666;
  font-size: 15px;
  font-weight: 600;
}

.dataLi > div {
  color: #717171;
  font-size: 13px;
}

.fistLi > div,
.dataLi > div {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fistLi > div:nth-child(1),
.dataLi > div:nth-child(1) {
  width: 30%;
  min-width: 45px;
}

.fistLi > div:nth-child(2),
.dataLi > div:nth-child(2) {
  width: 30%;
  min-width: 45px;
}

/* .fistLi > div:nth-child(3),
.dataLi > div:nth-child(3) {
  width: 10%;
  min-width: 70px;
} */

.fistLi > div:nth-child(4),
.dataLi > div:nth-child(4) {
  width: 15%;
  min-width: 70px;
}

.fistLi > div:nth-child(5),
.dataLi > div:nth-child(5) {
  width: 10%;
  min-width: 70px;
}

.fistLi > div:nth-child(6),
.dataLi > div:nth-child(6) {
  width: 15%;
  min-width: 70px;
}

.fistLi > div:nth-child(3) {
  width: 40%;
}

.dataLi .data-operation {
  display: flex;
  width: 40%;
  justify-content: space-around;
  align-items: center;
}

.data-operation > div {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.data-operation > div img {
  width: 20px;
  height: 20px;
}

.main-content-list ul {
  width: 100%;
  overflow: hidden;
  min-height: 500px;
}

.main-content-list {
  width: 100%;
  margin-top: 15px;
  min-height: 50px;
  /* border: 2px solid #00beff; */
  background-color: #ffff;
}

.main-list-feedback {
  position: relative;
  height: 27px;
  cursor: pointer;
  margin-left: 70px;
  font-weight: 600;
  font-size: 15px;
  color: #525252;
}

.main-list-basic {
  margin-left: 110px;
  position: relative;
  height: 27px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: #525252;
}

.main-list-select {
  color: #fe966d;
  position: relative;
}

.main-list-select::after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #fe966d;
  content: "";
}

.main-list-title > div:nth-child(1) {
  display: flex;
}

.main-list-title > div:nth-child(2) {
  margin-right: 50px;
}

.main-list-title {
  width: 100%;
  display: flex;
  height: 30px;
  margin-bottom: 18px;
  justify-content: space-between;
}
.main-list {
  margin-top: 20px;
}
.main-content {
  width: 100%;
  min-height: 500px;
}

.main-title h2 {
  height: 100%;
  margin-left: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #666;
}

.main-title {
  margin-left: 10px;
  width: 100%;
  height: 55px;
  background-color: #fff;
  line-height: 55px;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.content {
  overflow: hidden;
  min-height: 500px;
}

.content-center {
  overflow: hidden;
  width: calc(100% - 20px);
  margin-left: 10px;
  background-color: #fff;
  margin-top: 33px;
  border-radius: 3px;
}

/*取消弹出框*/

.delPopup {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.showdel {
  display: none;
}

.main-lookShow-top > div:nth-child(1) {
  font-size: 16px;
  font-weight: 600;
  color: #5c5c5c;
  margin-left: 20px;
}
.main-lookShow-top > div:nth-child(2) {
  margin-right: 20px;
  width: 35px;
  height: 35px;
  text-align: center;
  line-height: 35px;
  border: 1px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
}

.main-lookShow-top {
  display: flex;
  justify-content: space-between;
  height: 55px;
  align-items: center;
}

.main-lookShow {
  width: 650px;
  height: 650px;
  background-color: #fff;
  border-radius: 5px;
}
.lookShow {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-fade-enter-active {
  transition: all 0.7s ease;
}

.slide-fade-enter,
.slide-fade-leave-active {
  transform: translateY(-30px);
  opacity: 0;
}
</style>